home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / faq-s.zip / FAQUE.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-13  |  12KB  |  433 lines

  1. {$M 16384,5000,5000}
  2.  
  3. Uses Dos,Crt,configrt,gentypes,userret;
  4.  Var
  5.     Infile         :File of Userrec;
  6.     Uhfile         :File of mstr;
  7.     UserRecs       :Userrec;
  8.     Place,a,b,c,d,e:Integer;
  9.     Flag           :boolean;
  10.     Choice         :Char;
  11.     Counter        :Integer;
  12.     UserNum        :Integer;
  13.  
  14. const ueditver='1.00';
  15.  
  16. procedure cursor (b:boolean);
  17. var r:registers;
  18. begin
  19.   with r do begin
  20.   ah:=$01;
  21.   if not b then begin
  22.   ch:=$20; cl:=$20
  23.   end else begin
  24.   ch:=5; cl:=7
  25.   end
  26.  end;
  27.  intr ($10,r)
  28. end;
  29.  
  30. Procedure Show_Fields;
  31. Begin
  32. textcolor(15);
  33. textbackground (1);
  34.   Gotoxy(2,2); Write('User Handle ');
  35.   Gotoxy(2,3); Write('User Note   ');
  36.   Gotoxy(2,4); Write('Password    ');
  37.   Gotoxy(2,5); Write('Main Level  ');
  38.   Gotoxy(2,6); Write('File Level  ');
  39.   Gotoxy(2,7); Write('Phone Number');
  40.   Gotoxy(2,8); Write('Time Today  ');
  41.   Gotoxy(2,9); Write('File Points ');
  42.   Gotoxy(2,10);Write('Upload K    ');
  43.   Gotoxy(2,11);Write('Download K  ');
  44.   Gotoxy(2,12);Write('Uploads     ');
  45.   Gotoxy(2,13);Write('Downloads   ');
  46.   Gotoxy(2,14);Write('Gfile Level ');
  47.   Gotoxy(2,15);Write('Gfile UL''s  ');
  48.   Gotoxy(2,16);Write('Gfile DL''s  ');
  49.   Gotoxy(2,17);Write('Total Time  ');
  50.   Gotoxy(2,18);Write('Macro #1    ');
  51.   Gotoxy(2,19);Write('Macro #2    ');
  52.   Gotoxy(2,20);Write('Macro #3    ');
  53. End;
  54.  
  55. Procedure Place_Cursor;
  56.  Begin
  57.   With Userrecs do
  58.    Begin
  59.     textcolor (15); textbackground (7);
  60.     Case Place of
  61.     1:begin Gotoxy(2,2); Write('User Handle ');     end;
  62.     2:begin Gotoxy(2,3); Write('User Note   ');  end;
  63.     3:begin Gotoxy(2,4); Write('Password    ');   end;
  64.     4:begin Gotoxy(2,5); Write('Main Level  '); end;
  65.     5:begin Gotoxy(2,6); Write('File Level  '); end;
  66.     6:begin Gotoxy(2,7); Write('Phone Number');end;
  67.     7:begin Gotoxy(2,8); Write('Time Today  ');  end;
  68.     8:begin Gotoxy(2,9); Write('File Points '); end;
  69.     9:begin Gotoxy(2,10);Write('Upload K    ');   end;
  70.    10:begin Gotoxy(2,11);Write('Download K  '); end;
  71.    11:begin Gotoxy(2,12);Write('Uploads     ');    end;
  72.    12:begin Gotoxy(2,13);Write('Downloads   ');  end;
  73.    13:begin Gotoxy(2,14);Write('Gfile Level ');end;
  74.    14:begin Gotoxy(2,15);Write('Gfile UL''s  ');end;
  75.    15:Begin Gotoxy(2,16);Write('Gfile DL''s  ');end;
  76.    16:Begin Gotoxy(2,17);Write('Total Time  '); end;
  77.    17:Begin Gotoxy(2,18);Write('Macro #1    ');   end;
  78.    18:Begin Gotoxy(2,19);Write('Macro #2    ');   end;
  79.    19:Begin Gotoxy(2,20);Write('Macro #3    ');   end
  80.   End
  81.  End;
  82. textbackground (1);
  83. End;
  84.  
  85. Procedure Read_Cursor;
  86.  Begin
  87.   With Userrecs do
  88.    Begin
  89.     textcolor (11); textbackground (1);
  90.     Case Place of
  91.     1:begin Gotoxy(16,2);cursor(true);Read(Handle); place:=1;
  92.   {  if length(handle)<1 then place_cursor;
  93.   }  End;
  94.     2:Begin Gotoxy(16,3);cursor(true);Read(Note); place:=2;
  95.   {  if length(note)<1 then place_cursor;
  96.   }  End;
  97.     3:Begin Gotoxy(16,4);cursor(true);Read(password); place:=3;
  98.   {  if length(password)<1 then place_cursor;
  99.   }  End;
  100.     4:Begin Gotoxy(16,5);cursor(true);Read(level); place:=4;
  101.   {  if level<1 then place_cursor;
  102.   }  End;
  103.     5:Begin Gotoxy(16,6);cursor(true);Read(udlevel); place:=5;
  104.   {  if udlevel<1 then place_cursor;
  105.   }  End;
  106.     6:Begin Gotoxy(16,7);cursor(true);Read(phonenum); place:=6;
  107.   {  if length(phonenum)<1 then place_cursor;
  108.   }  End;
  109.     7:Begin Gotoxy(16,8);cursor(true);Read(timetoday); place:=7;
  110.   {  if timetoday<1 then place_cursor;
  111.   }  End;
  112.     8:Begin Gotoxy(16,9);cursor(true);Read(udpoints); place:=8;
  113.   {  if udpoints<1 then place_cursor;
  114.   }  End;
  115.     9:Begin Gotoxy(16,10);cursor(true);Read(upk); place:=9;
  116.   {  if upk<1 then place_cursor;
  117.   }  End;
  118.    10:Begin Gotoxy(16,11);cursor(true);Read(Downk); place:=10;
  119.   {  if downk<1 then place_cursor;
  120.   }  End;
  121.    11:Begin Gotoxy(16,12);cursor(true);Read(uploads); place:=11;
  122.   {  if uploads<1 then place_cursor;
  123.   }  End;
  124.    12:Begin Gotoxy(16,13);cursor(true);Read(downloads); place:=12;
  125.   {  if downloads<1 then place_cursor;
  126.   }  End;
  127.    13:Begin Gotoxy(16,14);cursor(true);Read(gflevel); place:=13;
  128.   {  if gflevel<1 then place_cursor;
  129.   }  End;
  130.    14:Begin Gotoxy(16,15);cursor(true);Read(gfuploads); place:=14;
  131.   {  if gfuploads<1 then place_cursor;
  132.   }  End;
  133.    15:Begin Gotoxy(16,16);cursor(true);Read(gfdownloads); place:=15;
  134.   {  if gfdownloads<1 then place_cursor;
  135.   }  End;
  136.    16:Begin Gotoxy(16,17);cursor(true);Read(totaltime); place:=16;
  137.   {  if totaltime<1 then place_cursor;
  138.   }  End;
  139.    17:Begin Gotoxy(16,18);cursor(true);Read(macro1); place:=17;
  140.   {  if length(macro1)<1 then place_cursor;
  141.   }  End;
  142.    18:Begin Gotoxy(16,19);cursor(true);Read(macro2); place:=18;
  143.   {  if length(macro2)<1 then place_cursor;
  144.   }  End;
  145.    19:Begin Gotoxy(16,20);cursor(true);Read(macro3); place:=19;
  146.   {  if length(macro3)<1 then place_cursor;
  147.   }  End;
  148.   End
  149.  End;
  150. cursor (false)
  151. End;
  152.  
  153.  
  154. Procedure List_Rec;
  155.    Begin
  156.     textcolor (15);
  157.     textbackground (1);
  158.     Seek(infile,Usernum);
  159.     Read(Infile,Userrecs);
  160.     Gotoxy(57,15);Write('User #: ',Usernum);
  161.     With UserRecs do
  162.     Begin
  163.       textcolor (11);
  164.       Gotoxy(16,2);Write(Handle);
  165.       Gotoxy(16,3);Write(Note);
  166.       Gotoxy(16,4);Write(password);
  167.       Gotoxy(16,5);Write(level);
  168.       Gotoxy(16,6);Write(udlevel);
  169.       Gotoxy(16,7);Write(phonenum);
  170.       Gotoxy(16,8);Write(timetoday);
  171.       Gotoxy(16,9);Write(udpoints);
  172.       Gotoxy(16,10);Write(upk);
  173.       Gotoxy(16,11);Write(Downk);
  174.       Gotoxy(16,12);Write(uploads);
  175.       Gotoxy(16,13);Write(downloads);
  176.       Gotoxy(16,14);Write(gflevel);
  177.       Gotoxy(16,15);Write(gfuploads);
  178.       Gotoxy(16,16);Write(gfdownloads);
  179.       Gotoxy(16,17);Write(totaltime:6:2);
  180.       Gotoxy(16,18);Write(macro1);
  181.       Gotoxy(16,19);Write(macro2);
  182.       Gotoxy(16,20);Write(macro3);
  183.     End
  184.    End;
  185.  
  186.  
  187. Procedure Open_Rec;
  188.     Begin
  189.       Assign(Infile,bbsdatadir+'USERS.DAT');
  190.       Reset(Infile);
  191.       assign(Uhfile,bbsdatadir+'USERINDX.DAT');
  192.       Reset(Uhfile);
  193.       Counter:=0;
  194.       While not eof (Infile) do Begin
  195.         Read(Infile,userrecs);
  196.         Counter:=Counter+1
  197.       end;
  198.       UserNum:=1
  199.     end;
  200.  
  201.  Procedure Write_Rec;
  202.  Begin
  203.      seek (infile,usernum);
  204.      write (infile,userrecs);
  205.      seek (uhfile,usernum);
  206.      write (uhfile,userrecs.handle);
  207.  End;
  208.  
  209. Procedure Format_Data_Area;
  210.     Begin
  211.      For A:=2 to 20 do begin
  212.          GotoXy(16,A);Write('                                   ');
  213.          End;
  214.     Gotoxy(69,15);Write('   ');
  215.     Gotoxy(57,17);Write('            ');
  216.     End;
  217.  
  218. Procedure Delete_Rec;
  219.     Begin
  220.     With Userrecs do
  221.     Begin
  222.      Nbu:=0;
  223.      Handle:='';
  224.      Note:='';
  225.      Password:='';
  226.      Level:=0;
  227.      Udlevel:=0;
  228.      Phonenum:='';
  229.      TimeToday:=0;
  230.      Udpoints:=0;
  231.      Upk:=0;
  232.      Downk:=0;
  233.      Uploads:=0;
  234.      Downloads:=0;
  235.      Write_Rec;
  236.      List_Rec;
  237.      Gflevel:=0;
  238.      Gfuploads:=0;
  239.      Gfdownloads:=0;
  240.      TotalTime:=0;
  241.      Macro1:='';
  242.      Macro2:='';
  243.      Macro3:=''
  244.   end;
  245.   Write_Rec;
  246.   Format_Data_Area;
  247.   List_Rec
  248.  End;
  249.  
  250.  
  251. Procedure Add_Rec;
  252.    Begin
  253.     Usernum:=Counter;
  254.     Counter:=Counter+1;
  255.     textcolor (15); textbackground (1);
  256.     GotoXy(57,15);Write('User Number: ',Usernum);
  257.     With UserRecs do
  258.     Begin
  259.       nbu:=0;
  260.       textcolor (11);
  261.       Gotoxy(16,2);cursor(true);Read(Handle);
  262.       Gotoxy(16,3);cursor(true);Read(Note);
  263.       Gotoxy(16,4);cursor(true);Read(password);
  264.       Gotoxy(16,5);cursor(true);Read(level);
  265.       Gotoxy(16,6);cursor(true);Read(udlevel);
  266.       Gotoxy(16,7);cursor(true);Read(phonenum);
  267.       Gotoxy(16,8);cursor(true);Read(timetoday);
  268.       Gotoxy(16,9);cursor(true);Read(udpoints);
  269.       Gotoxy(16,10);cursor(true);Read(upk);
  270.       Gotoxy(16,11);cursor(true);Read(Downk);
  271.       Gotoxy(16,12);cursor(true);Read(uploads);
  272.       Gotoxy(16,13);cursor(true);Read(downloads);
  273.       Gotoxy(16,14);cursor(true);Read(gflevel);
  274.       Gotoxy(16,15);cursor(true);Read(gfuploads);
  275.       Gotoxy(16,16);cursor(true);Read(gfdownloads);
  276.       Gotoxy(16,17);cursor(true);Read(totaltime);
  277.       Gotoxy(16,18);cursor(true);Read(macro1);
  278.       Gotoxy(16,19);cursor(true);Read(macro2);
  279.       Gotoxy(16,20);cursor(true);Read(macro3);
  280.     End;
  281.     Seek(Infile,usernum);
  282.     Write(Infile,UserRecs);
  283.    cursor (false)
  284.    End;
  285.  
  286.  
  287. var i:integer;
  288. Begin
  289.   cursor (false);
  290.   readconfig;
  291.   ClrScr;
  292.   textbackground (1);
  293.   for i:=1 to 25 do begin
  294.   gotoxy (1,i); clreol; end;
  295.   A:=0;
  296.   B:=0;
  297.   C:=0;
  298.   d:=0;
  299.   Flag:=False;
  300.   textcolor (9);
  301.   Gotoxy(1,1);
  302.   Write('┌────────────┐');
  303.   For A:=2 to 20 do Begin
  304.     Gotoxy(1,a);
  305.     Write('│            │')
  306.   End;
  307.   Gotoxy(1,21);
  308.   Write('└────────────┘');
  309.   Gotoxy(15,1);
  310.   Write('┌───────────────────────────────────┐');
  311.   For A:=2 to 22 do Begin
  312.     Gotoxy(15,a);
  313.     Write('│                                   │')
  314.   End;
  315.   Gotoxy(15,23);
  316.   Write('└───────────────────────────────────┘');
  317.   Show_Fields;
  318.   Gotoxy(80,24);
  319.   textcolor (15);
  320.   Write('    [Q] Save/Quit       [PageUp] Next User          [PageDown] Previous User');
  321.   gotoxy(55,1);
  322.   Write('┌─────────────────┐');
  323.   For A:=2 to 10 do Begin
  324.     Gotoxy(55,a);
  325.     Write('│                 │')
  326.   End;
  327.   Gotoxy(55,10);
  328.   Write('└─────────────────┘');
  329.   textcolor (11);
  330.   Gotoxy(57,2);
  331.   Write('FAQ User Editor');
  332.   Gotoxy(57,3);
  333.   Write(ueditver+' - by');
  334.   Gotoxy(57,4);
  335.   Write('The Firegod');
  336.   Gotoxy(57,5);
  337.   Write('(C)BaseTwo');
  338.   Gotoxy(57,6);
  339.   Write('Software 1991');
  340.   textcolor (9);
  341.   Gotoxy(55,11);
  342.   Write('┌──────────────────┐');
  343.   For A:=12 to 20 do Begin
  344.     Gotoxy(55,a);
  345.     Write('│                  │')
  346.   End;
  347.   Gotoxy(55,20);
  348.   Write('└──────────────────┘');
  349.   textcolor (15);
  350.   Gotoxy(57,12);
  351.   Write('[A] Add User');
  352.   Gotoxy(57,13);
  353.   Write('[D] Delete User');
  354.   Gotoxy(57,19);
  355.   Write('[ESC] to Quit');
  356.   textcolor (9);
  357.   Open_Rec;
  358.   Format_Data_Area;
  359.   List_Rec;
  360.   Place:=1;
  361.   Place_Cursor;
  362.   While Flag=False do Begin
  363.      Choice:=upcase(Readkey);
  364.      Case Choice of
  365.      'A':Begin
  366.            Format_Data_Area;
  367.            Add_Rec
  368.          End;
  369.      'D':Begin
  370.            Gotoxy(57,17);
  371.            Write('Delete User?');
  372.            cursor(true);Choice:=upcase(Readkey);cursor (false);
  373.            If Choice='Y' then delete_rec else Begin
  374.              Gotoxy(57,17);
  375.              Write('             ')
  376.            End
  377.          End;
  378.      'Q':Begin
  379.            Write_Rec;
  380.            Close(Infile);
  381.            textcolor (7);
  382.            textbackground (0);
  383.            cursor (true);
  384.            ClrScr;
  385.            Halt
  386.          End;
  387.      #27:Begin
  388.            Write_Rec;
  389.            Close(Infile);
  390.            textcolor (7);
  391.            textbackground (0);
  392.            cursor (true);
  393.            ClrScr;
  394.            Halt
  395.          End;
  396.      #13:begin Read_Cursor; end;
  397.      #0:begin Place_Cursor;
  398.           Choice:=upcase(Readkey);
  399.           Case Choice of
  400.            #73:Begin
  401.                  Write_Rec;
  402.                  Usernum:=Usernum+1;
  403.                  If Usernum>=counter then Usernum:=1;
  404.                  Format_Data_Area;
  405.                  List_Rec
  406.                End;
  407.            #81:Begin
  408.                  Write_Rec;
  409.                  Usernum:=Usernum-1;
  410.                  If Usernum<1 then usernum:=Counter-1;
  411.                  Format_Data_Area;
  412.                  List_Rec
  413.                End;
  414.            #72:Begin
  415.                  Place:=Place-1;
  416.                  if Place<1 then place:=19;
  417.                  Show_Fields;
  418.                  Place_Cursor
  419.                End;
  420.            #80:Begin
  421.                  Place:=Place+1;
  422.                  If Place>19 then place:=1;
  423.                  Show_Fields;
  424.                  Place_Cursor
  425.                End;
  426.       End;
  427.      End;
  428.   End;
  429. End;
  430. textcolor (7);
  431. textbackground (0);
  432. cursor (true);
  433. End.